<@html.doctype />
<html>
<@html.head>
	<link rel="stylesheet" type="text/css" href="../includes/styles/skins/Green/layout/css/layout_demo.css" />
	<script type="text/javascript" src="../includes/js/jsLayout/jquery_picture.js"></script>
	<script type="text/javascript" src="../includes/js/jsLayout/pic.js"></script>

	<script>
	    $(function(){
	        var loading=false;
	        var loadcount = 0;
	        $(window).scroll(function(e){
	            if(loading||loadcount>=3){
	                return true;
	            }
	            if($("#moretasklink").offset().top<$(window).scrollTop()+$(window).height()){
	                loading=true;
	                get_task_next_page($('#pagination-page').val(),
	                    function(){
	                        loading=false;
	                        loadcount+=1;
	                    },
	                    function(){
	                        $(window).unbind("scroll");                        
	                    },
	                    function(){loading=false;});
	            }
	            return true;
	        });        
	    });
	
	function switch_selected(obj, obj_to_show){
		if(obj.hasClass('active')){
			obj_to_show.removeClass('active');
			obj.removeClass('active');
			return 1;
		}
		obj.parent().find(".active").each(function(){
			$(this).removeClass("active");
		});
		obj_to_show.parent().find(".active").each(function(){
			$(this).removeClass("active");
		});
		
		obj_to_show.addClass("active");
		obj.addClass('active');
		return 0;
	}
	function refresh_random_template(obj){
		obj_to_show = $("#random-template-wrapper");
		obj.parent().find(".active").each(function(){
			$(this).removeClass("active");
		});
		obj_to_show.parent().find(".active").each(function(){
			$(this).removeClass("active");
		});
		
		obj_to_show.addClass("active");
		obj.addClass('active');
	
		o = $("#random-template");
		o.html("Loading");
	
		$.ajax({
			type : "GET",
			url : "/task/quick_post/",
			data : {"type":"ajax","need":"random_template"},
			dataType :"html",
			success : function(data) {
				o.html(data);
				o.val(data);
			}
		}); 
		return 0;
	}
	function show_comments(tid, obj){
		if (switch_selected(obj, obj.parent().parent().next()))
			return;
		obj = obj.parent().parent().next();
		obj.html("<img src='/media/images/timeline-join-ajax-loader.gif'>");
		$.ajax({
			type : "GET",
			url : "/task/"+tid,
			data : {"type":"ajax","need":"comments"},
			dataType :"html",
			success : function(data) {
				obj.html(data);
			}
		}); 
	}
	function ajax_commit_comment(obj){
		obj.find(".prompt").text("正在提交评论...");
	    $.ajax({
	        url:obj.attr("action"),
	        type:"GET",
	        data:{
	            'comment-content':obj.find("#comment-content").val(),
	            'tid':obj.find("#tid").val(),
	            'from_id':obj.find("#from_id").val(),
	            'to_id':obj.find("#to_id").val(),
	            "type":"ajax",
				"need":"commit-comment"
	        },
	        dataType:"html",
	        success:function(data){
	            obj.parent().html(data);
	            //obj.find(".prompt").text("评论发表成功"); 
	            //obj.find("#comment-content").val("");
	            if(_gaq){
	                _gaq.push(['_trackPageview','add_comment']);
	            }
	        },
	        error:function(){
	            obj.find(".prompt").text("评论发表失败");
				if(_gaq){
	                _gaq.push(['_trackPageview','add_comment']);
	            }
	        }
	    });     
	}
	function reply_comment(obj, to_id, name){
		obj.find("#to_id").val(to_id);
		ta = obj.find("#comment-content");
		ta.focus();
		ta.val("对"+name+"说：")
	}
	function ctrl_enter_to_post(event, obj)
	{
		if(event.ctrlKey == true && event.keyCode == 13)
		{
			ajax_commit_comment(obj);
		}
		check_textarea_length(event);
	}
	function show_biddings(tid, obj){
		if (switch_selected(obj, obj.parent().parent().next()))
			return;
		obj = obj.parent().parent().next();
	    obj.html("<img src='/media/images/timeline-join-ajax-loader.gif'>");
		//obj.html("show_biddings");
		$.ajax({
			type : "GET",
			url : "/task/"+tid,
			data : {"type":"ajax","need":"biddings"},
			dataType :"html",
			success : function(data) {
				obj.html(data);
			}
		}); 
	}
	function show_pictures(tid, obj){
		if (switch_selected(obj, obj.parent().parent().next()))
			return;
		obj = obj.parent().parent().next();
		obj.html("<img src='/media/images/timeline-join-ajax-loader.gif'>");
		//obj.html("show_pictures");
		$.ajax({
			type : "GET",
			url : "/task/"+tid,
			data : {"type":"ajax","need":"pictures"},
			dataType :"html",
			success : function(data) {
				obj.html(data);
			}
		}); 
	}
	
	
	</script>

	<script type="text/javascript">
	function show1(){
		var hiddText=document.getElementById("form-type1").style.display;
		if(hiddText=="none"){
		document.getElementById("form-type1").style.display="block";
		document.getElementById("form-type2").style.display="none";
		document.getElementById("form-type3").style.display="none";
		document.getElementById("form-type4").style.display="none";
		}
	else if(hiddText=="block")
		document.getElementById("form-type1").style.display="none";
	}
	
	function show2(){
		var hiddText=document.getElementById("form-type2").style.display;
		if(hiddText=="none"){
		document.getElementById("form-type2").style.display="block";
		document.getElementById("form-type1").style.display="none";
		document.getElementById("form-type3").style.display="none";
		document.getElementById("form-type4").style.display="none";
		}
		
	else if(hiddText=="block")
		document.getElementById("form-type2").style.display="none";
	}
	
	
	function show3(){
		var hiddText=document.getElementById("form-type3").style.display;
		if(hiddText=="none"){
		document.getElementById("form-type3").style.display="block";
		document.getElementById("form-type1").style.display="none";
		document.getElementById("form-type4").style.display="none";
		document.getElementById("form-type2").style.display="none";
		}
		
	else if(hiddText=="block")
		document.getElementById("form-type3").style.display="none";
	}
	
	function show4(){
		var hiddText=document.getElementById("form-type4").style.display;
		if(hiddText=="none"){
		document.getElementById("form-type4").style.display="block";
		document.getElementById("form-type1").style.display="none";
		document.getElementById("form-type3").style.display="none";
		document.getElementById("form-type2").style.display="none";
		}
		
	else if(hiddText=="block")
		document.getElementById("form-type4").style.display="none";
	}
	
	
	

</script>

</@html.head>
<body>

<@html.header>
	<!--请不要在此处添加内容-->
</@html.header>

<@html.content>
<div id="content" style="background:url(../includes/styles/skins/Green/layout/fy_bac.gif) repeat;">
	<!--请在此处添加页面内容-->
	<@html.contentplace place="项目中心"/><br/>
	<#include "./fud.ftl"/>   
	<#include "./left.ftl"/>  
	<#include "./right.ftl"/>  
</div>
</@html.content>

<@html.bottom>
	<!--请不要在此处添加内容-->
</@html.bottom>

</body>
</html>